Visual Basic (Declaration) | |
---|---|
Public Class SetList(Of T) Implements CSharpTest.Net.Interfaces.ICloneable(Of SetList(Of T)) |
C# | |
---|---|
public class SetList<T> : CSharpTest.Net.Interfaces.ICloneable<SetList<T>> |
- T
Library/Library.Test/TestSetList.cs
C# | Copy Code |
---|---|
SetList<string> list = new SetList<string>((IEnumerable<string>)new string[] { "a", "B" }); Assert.AreEqual("a,B", String.Join(",", list.ToArray())); list = new SetList<string>(2); Assert.AreEqual("", String.Join(",", list.ToArray())); list.Add("a"); list.Add("B"); Assert.AreEqual("a,B", String.Join(",", list.ToArray())); list = new SetList<string>(2, StringComparer.Ordinal); Assert.AreEqual("", String.Join(",", list.ToArray())); list.Add("a"); list.Add("B"); Assert.AreEqual("B,a", String.Join(",", list.ToArray())); list = new SetList<string>(2, StringComparer.OrdinalIgnoreCase); list.Add("a"); list.Add("B"); Assert.AreEqual("a,B", String.Join(",", list.ToArray())); list = new SetList<string>(new string[] { "B", "a" }, StringComparer.Ordinal); Assert.AreEqual("B,a", String.Join(",", list.ToArray())); list = new SetList<string>((IEnumerable<string>)new string[] { "B", "a" }, StringComparer.OrdinalIgnoreCase); Assert.AreEqual("a,B", String.Join(",", list.ToArray())); |
VB.NET | Copy Code |
---|---|
Dim list As New SetList(Of String)(DirectCast(New String() {"a", "B"}, IEnumerable(Of String))) Assert.AreEqual("a,B", [String].Join(",", list.ToArray())) list = New SetList(Of String)(2) Assert.AreEqual("", [String].Join(",", list.ToArray())) list.Add("a") list.Add("B") Assert.AreEqual("a,B", [String].Join(",", list.ToArray())) list = New SetList(Of String)(2, StringComparer.Ordinal) Assert.AreEqual("", [String].Join(",", list.ToArray())) list.Add("a") list.Add("B") Assert.AreEqual("B,a", [String].Join(",", list.ToArray())) list = New SetList(Of String)(2, StringComparer.OrdinalIgnoreCase) list.Add("a") list.Add("B") Assert.AreEqual("a,B", [String].Join(",", list.ToArray())) list = New SetList(Of String)(New String() {"B", "a"}, StringComparer.Ordinal) Assert.AreEqual("B,a", [String].Join(",", list.ToArray())) list = New SetList(Of String)(DirectCast(New String() {"B", "a"}, IEnumerable(Of String)), StringComparer.OrdinalIgnoreCase) Assert.AreEqual("a,B", [String].Join(",", list.ToArray())) |
System.Object
CSharpTest.Net.Collections.SetList<T>
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
Reference
SetList<T> MembersCSharpTest.Net.Collections Namespace